# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1ImportDocumentsRequest do
  @moduledoc """
  Request message for Import methods.

  ## Attributes

  *   `alloyDbSource` (*type:* `GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1AlloyDbSource.t`, *default:* `nil`) - AlloyDB input source.
  *   `autoGenerateIds` (*type:* `boolean()`, *default:* `nil`) - Whether to automatically generate IDs for the documents if absent. If set to `true`, Document.ids are automatically generated based on the hash of the payload, where IDs may not be consistent during multiple imports. In which case ReconciliationMode.FULL is highly recommended to avoid duplicate contents. If unset or set to `false`, Document.ids have to be specified using id_field, otherwise, documents without IDs fail to be imported. Supported data sources: * GcsSource. GcsSource.data_schema must be `custom` or `csv`. Otherwise, an INVALID_ARGUMENT error is thrown. * BigQuerySource. BigQuerySource.data_schema must be `custom` or `csv`. Otherwise, an INVALID_ARGUMENT error is thrown. * SpannerSource. * CloudSqlSource. * FirestoreSource. * BigtableSource.
  *   `bigquerySource` (*type:* `GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1BigQuerySource.t`, *default:* `nil`) - BigQuery input source.
  *   `bigtableSource` (*type:* `GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1BigtableSource.t`, *default:* `nil`) - Cloud Bigtable input source.
  *   `cloudSqlSource` (*type:* `GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1CloudSqlSource.t`, *default:* `nil`) - Cloud SQL input source.
  *   `errorConfig` (*type:* `GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1ImportErrorConfig.t`, *default:* `nil`) - The desired location of errors incurred during the Import.
  *   `fhirStoreSource` (*type:* `GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1FhirStoreSource.t`, *default:* `nil`) - FhirStore input source.
  *   `firestoreSource` (*type:* `GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1FirestoreSource.t`, *default:* `nil`) - Firestore input source.
  *   `forceRefreshContent` (*type:* `boolean()`, *default:* `nil`) - Optional. Whether to force refresh the unstructured content of the documents. If set to `true`, the content part of the documents will be refreshed regardless of the update status of the referencing content.
  *   `gcsSource` (*type:* `GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1GcsSource.t`, *default:* `nil`) - Cloud Storage location for the input content.
  *   `idField` (*type:* `String.t`, *default:* `nil`) - The field indicates the ID field or column to be used as unique IDs of the documents. For GcsSource it is the key of the JSON field. For instance, `my_id` for JSON `{"my_id": "some_uuid"}`. For others, it may be the column name of the table where the unique ids are stored. The values of the JSON field or the table column are used as the Document.ids. The JSON field or the table column must be of string type, and the values must be set as valid strings conform to [RFC-1034](https://tools.ietf.org/html/rfc1034) with 1-63 characters. Otherwise, documents without valid IDs fail to be imported. Only set this field when auto_generate_ids is unset or set as `false`. Otherwise, an INVALID_ARGUMENT error is thrown. If it is unset, a default value `_id` is used when importing from the allowed data sources. Supported data sources: * GcsSource. GcsSource.data_schema must be `custom` or `csv`. Otherwise, an INVALID_ARGUMENT error is thrown. * BigQuerySource. BigQuerySource.data_schema must be `custom` or `csv`. Otherwise, an INVALID_ARGUMENT error is thrown. * SpannerSource. * CloudSqlSource. * FirestoreSource. * BigtableSource.
  *   `inlineSource` (*type:* `GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1ImportDocumentsRequestInlineSource.t`, *default:* `nil`) - The Inline source for the input content for documents.
  *   `reconciliationMode` (*type:* `String.t`, *default:* `nil`) - The mode of reconciliation between existing documents and the documents to be imported. Defaults to ReconciliationMode.INCREMENTAL.
  *   `spannerSource` (*type:* `GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1SpannerSource.t`, *default:* `nil`) - Spanner input source.
  *   `updateMask` (*type:* `String.t`, *default:* `nil`) - Indicates which fields in the provided imported documents to update. If not set, the default is to update all fields.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :alloyDbSource =>
            GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1AlloyDbSource.t() | nil,
          :autoGenerateIds => boolean() | nil,
          :bigquerySource =>
            GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1BigQuerySource.t()
            | nil,
          :bigtableSource =>
            GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1BigtableSource.t()
            | nil,
          :cloudSqlSource =>
            GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1CloudSqlSource.t()
            | nil,
          :errorConfig =>
            GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1ImportErrorConfig.t()
            | nil,
          :fhirStoreSource =>
            GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1FhirStoreSource.t()
            | nil,
          :firestoreSource =>
            GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1FirestoreSource.t()
            | nil,
          :forceRefreshContent => boolean() | nil,
          :gcsSource =>
            GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1GcsSource.t() | nil,
          :idField => String.t() | nil,
          :inlineSource =>
            GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1ImportDocumentsRequestInlineSource.t()
            | nil,
          :reconciliationMode => String.t() | nil,
          :spannerSource =>
            GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1SpannerSource.t() | nil,
          :updateMask => String.t() | nil
        }

  field(:alloyDbSource,
    as: GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1AlloyDbSource
  )

  field(:autoGenerateIds)

  field(:bigquerySource,
    as: GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1BigQuerySource
  )

  field(:bigtableSource,
    as: GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1BigtableSource
  )

  field(:cloudSqlSource,
    as: GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1CloudSqlSource
  )

  field(:errorConfig,
    as: GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1ImportErrorConfig
  )

  field(:fhirStoreSource,
    as: GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1FhirStoreSource
  )

  field(:firestoreSource,
    as: GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1FirestoreSource
  )

  field(:forceRefreshContent)
  field(:gcsSource, as: GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1GcsSource)
  field(:idField)

  field(:inlineSource,
    as:
      GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1ImportDocumentsRequestInlineSource
  )

  field(:reconciliationMode)

  field(:spannerSource,
    as: GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1SpannerSource
  )

  field(:updateMask)
end

defimpl Poison.Decoder,
  for: GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1ImportDocumentsRequest do
  def decode(value, options) do
    GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1ImportDocumentsRequest.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1ImportDocumentsRequest do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
